package service;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import Entities.HelloMessage;

@Stateless
public class MessageService {
    @PersistenceContext
    EntityManager em;

    public void save(HelloMessage hm){
        this.em.persist(hm);
    }

    @SuppressWarnings("unchecked")
	public List<HelloMessage> getMessages(){
        return this.em.createNamedQuery("HelloMessage.findAll").getResultList();
    }
}